package part1;

public class Main {
    public static void main(String[] args) {
        // 使用命令模式，通过遥控器，对电灯进行操控
        LightReceiver lightReceiver = new LightReceiver();
        LightOnCommand lightOnCommand = new LightOnCommand(lightReceiver);
        LightOffCommand lightOffCommand = new LightOffCommand(lightReceiver);

        // 创建遥控器
        RemoteController remoteController = new RemoteController();
        remoteController.setCommand(0, lightOnCommand, lightOffCommand);

        // 进行操作
        remoteController.onButtonPush(0);
        remoteController.offButtonPush(0);
        remoteController.undo();
    }
}
